<?php
/*
+--------------------------------------------------------------------------
|   AffiliStore 2
|   ========================================
|   Web: http://www.affilistore.com
|   Email: admin (at) affilistore (dot) com
|	License Type: AffiliStore 2 is NOT open source software and limitations apply 
|   Licence Info: Visit AffiliStore website and click on 'Licence'
+--------------------------------------------------------------------------
*/
// checks to see if password session is set
// if not redirects to ../admin/
if($_SESSION['loggedIn'] == 0 && !isset($adminPage)){
include('../includes/auth.inc.php');
}

extract($_POST);

mysql_select_db($database, $databaseConnect);

// get username and password from database
$getConfigUser = mysql_query("SELECT value FROM affiliSt_config WHERE name = 'adUsername'");
$configUser = mysql_fetch_assoc($getConfigUser);
$getConfigPass = mysql_query("SELECT value FROM affiliSt_config WHERE name = 'adPassword'");
$configPass = mysql_fetch_assoc($getConfigPass);

$adUser = $configUser['value'];
$adPass = $configPass['value'];

// send login details to session
if (isset($_POST['as_login'])) {
$_SESSION['as_aduser'] = $_POST['as_aduser'];
$_SESSION['as_adpass'] = $_POST['as_adpass'];
}

if ($_GET['ad'] == 'logout') {
session_destroy();
header("Location: ../index.php");

}


// get install directory
$getInstallDir = mysql_query("SELECT * FROM affiliSt_config WHERE name = 'installDir'");
$installDir = mysql_fetch_assoc($getInstallDir);
$getLogoImage = mysql_query("SELECT * FROM affiliSt_config WHERE name = 'adLogo'");
$logoImage = mysql_fetch_assoc($getLogoImage);